package com.lanou.springbootdruid.controller;

import com.lanou.springbootdruid.mapper.UserMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/")
public class HelloController {

	@Resource
	private UserMapper userMapper;

	@RequestMapping("hello")
	public ModelAndView hello(String username, ModelAndView modelAndView) {
		modelAndView.setViewName("hello1");
		modelAndView.addObject("user",userMapper.find(username));
		return modelAndView;
	}
}
